<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <h:form id="EscursioneListForm">

        <p:panel header="#{myBundle.ListEscursioneTitle}">

            <p:dataTable id="datalist" value="#{escursioneController.items}" var="item"
                         selectionMode="single" selection="#{escursioneController.selected}"
                         rowKey="#{item.idESCURSIONE}"
                         paginator="true"
                         rows="10"
                         rowsPerPageTemplate="10,20,30"
                         >

                <p:ajax event="rowSelect"   update="createButton viewButton editButton deleteButton"/>
                <p:ajax event="rowUnselect" update="createButton viewButton editButton deleteButton"/>

                <p:column sortBy="#{item.idESCURSIONE}" filterBy="#{item.idESCURSIONE}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_idESCURSIONE}"/>
                    </f:facet>
                    <h:outputText value="#{item.idESCURSIONE}"/>
                </p:column>
                <p:column sortBy="#{item.prezzo}" filterBy="#{item.prezzo}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_prezzo}"/>
                    </f:facet>
                    <h:outputText value="#{item.prezzo}"/>
                </p:column>
                <p:column sortBy="#{item.data}" filterBy="#{item.data}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_data}"/>
                    </f:facet>
                    <h:outputText value="#{item.data}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:outputText>
                </p:column>
                <p:column sortBy="#{item.descrizione}" filterBy="#{item.descrizione}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_descrizione}"/>
                    </f:facet>
                    <h:outputText value="#{item.descrizione}"/>
                </p:column>
                <p:column sortBy="#{item.luogo.nome}" filterBy="#{item.luogo.nome}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_luogo}"/>
                    </f:facet>
                    <h:outputText value="#{item.luogo.nome}"/>
                </p:column>
                <p:column sortBy="#{item.elemento.idELEMENTO}" filterBy="#{item.elemento.idELEMENTO}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListEscursioneTitle_elemento}"/>
                    </f:facet>
                    <h:outputText value="#{item.elemento.idELEMENTO}"/>
                </p:column>
                <f:facet name="footer">
                    <div class="footer-section">
                        <p:commandButton id="createButton" icon="ui-icon-plus"   value="#{myBundle.Create}" actionListener="#{escursioneController.prepareCreate}" update=":EscursioneCreateForm" oncomplete="EscursioneCreateDialog.show()"/>
                        <p:commandButton id="viewButton"   icon="ui-icon-search" value="#{myBundle.View}" update=":EscursioneViewForm" oncomplete="EscursioneViewDialog.show()" disabled="#{empty escursioneController.selected}"/>
                        <p:commandButton id="editButton"   icon="ui-icon-pencil" value="#{myBundle.Edit}" update=":EscursioneEditForm" oncomplete="EscursioneEditDialog.show()" disabled="#{empty escursioneController.selected}"/>
                        <p:commandButton id="deleteButton" icon="ui-icon-trash"  value="#{myBundle.Delete}" actionListener="#{escursioneController.delete}" update=":growl,datalist" disabled="#{empty escursioneController.selected}"/>
                    </div>
                </f:facet>

            </p:dataTable>

        </p:panel>

    </h:form>

</ui:composition>